package classes
{
	import SEApp.se_util;
	
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.BitmapDataChannel;
	import flash.display.BlendMode;
	import flash.display.DisplayObject;
	import flash.geom.Point;

	public class clt_bitmap extends Bitmap {
		public function clt_bitmap(bitmapData:BitmapData=null, pixelSnapping:String='auto', smoothing:Boolean=false) {
			super(bitmapData, pixelSnapping, smoothing);
		}
		
		public function copy(a_source: DisplayObject): void {
			se_util.bmpCopy(a_source, 1, this);
		}
		
		public function asAlpha(a_source: DisplayObject, invert: Boolean = false): void {
			var tmp: clt_bitmap = new clt_bitmap();
			tmp.copy(a_source);
			if (invert) tmp.bitmapData.draw(tmp.bitmapData, null, null, BlendMode.INVERT);
			bitmapData.copyChannel(tmp.bitmapData, tmp.bitmapData.rect, new Point(0, 0), BitmapDataChannel.GREEN, BitmapDataChannel.ALPHA);
			tmp.bitmapData.dispose();
		}
		
		public function get size(): Point {
			return new Point(bitmapData.width, bitmapData.height);
		}
	}
}